#include <vector>
#include <unordered_map>
using namespace std;
class Solution{
    public:
        vector<int> twoSum(vector<int> &nums, int target);
};

vector<int> Solution::twoSum(vector<int> &nums, int target)
{
    unordered_map<int,int> map;
    int len = nums.size();
    for (int i = 0; i < len; i++)
    {
        auto it = map.find(target-nums[i]);
        if(it != map.end()){
            
            return {it->second,i};
        }
        map[nums[i]] = i;
    }
    return {};
}